# l=[1,2,3]
# a=0
# while a<len(l):
#     print(l[a])
#     a+=1
# #

# class peoples(object):
#     def __new__(cls, *args, **kwargs):
#         print('111')
#     #     # return
#     def __init__(self):
#         print('222')
#         self.age=18
# a=peoples()
# print(a.age)
#
#
# class Book(object):
#     def __new__(cls, title):
#         print('__new__')
#         return super(Book, cls).__new__(cls)
#
#     def __init__(self, title):
#         print('__init__')
#         super(Book, self).__init__()
#         self.title = title
#
#
# b = Book('The Django Book')
# print(b.title)

#
# def quick_sort(alist,start,end):
#     if start>=end:
#         return
#
#     mid=alist[start]
#     l=start
#     r=end
#
#     while l<r:
#         while l<r and alist[r]>=mid:
#             r-=1
#         alist[l]=alist[r]
#
#         while l<r and alist[l]<mid:
#             l+=1
#         alist[r]=alist[l]
#
#         mid=alist[l]
#         quick_sort(alist,start,l-1)
#         quick_sort(alist,l+1,end)
#
# li = [54, 26, 93, 17, 77, 31, 44, 55, 20]
# quick_sort(li,0,len(li)-1)
# print(li)

# def shell_sort(alist):
#     n=len(alist)
#     step=n//2
#     while step>0:
#         for i in range(step,n):
#             while i>=step and alist[i-step]>alist[i]:
#                 alist[i - step],alist[i]=alist[i],alist[i-step]
#                 i-=step
#         step=step//2
# def mo_sort(alist):
#     for i in range(len(alist)-1,0,-1):
#         for j in range(0,i):
#             if alist[j]>alist[j+1]:
#                 alist[j],alist[j+1]=alist[j+1],alist[j]

# def select_sort(alist):
#     n=len(alist)
#     for i in range(n-1):
#         min_index=i
#
#         for j in range(i+1,n):
#             if alist[j]<alist[min_index]:
#                 min_index=j
#                 print(min_index)
#
#         if min_index !=i:
#             alist[i],alist[min_index]=alist[min_index],alist[i]

# def inset_sort(alist):
#     for i in range(1,len(alist)):
#         for j in range(i,0,-1):
#             while alist[j]<alist[j-1]:
#                 alist[j],alist[j-1]=alist[j-1],alist[j]

# def merge_sort(alist):
#     if len(alist)<=1:
#         return alist
#     num=len(alist)//2
#     left=merge_sort(alist[:num])
#     right=merge_sort(alist[num:])
#     return merge(left,right)
# def merge(left,right):
#     l,r=0,0
#     result=[]
#     while l<len(left) and r<len(right):
#         if left[l]<right[r]:
#             result.append(left[l])
#             l+=1
#         else:
#             result.append(right[r])
#             r+=1
#     result+=left[l:]
#     result+=right[r:]
#     return result
#
#
# li = [54, 2, 93, 17, 77, 31, 44, 55, 20,17]
# ali=merge_sort(li)
# # inset_sort(li)
# # shell_sort(li)
# # mo_sort(li)
# # select_sort(li)
# print(ali)
# a='as,as aa'
# b='as,as cc '
# print(id(a))
# print(id(b))
# import sys
# a=[1,2,3]
# print(id(a))
# print(id(a[1]))
# b=a
# print(sys.getrefcount(a[1]))
# a=[1,2,3]
# b=[2,4,6]
# print(c)
# c=[]
# for i in a:
#     if i not in b:
#         c.append(i)
# print(c)
# a = [1, 4, 2, 3]
# n=len(a)
# l=[]
# for i in range(n):
#     l.append(a[i])
# print(l)
# b=a[::-1]

# print(b)
# a.sort(reverse=True)
# print(a)
# def isHuiWen(str):
#     if (len(str) < 2):
#         return True
#     if str[0] != str[-1]:
#         return False
#     return isHuiWen(str[1:-1])
#
# str = input("请输入一个字符串：")
# if isHuiWen(str):
#     print("该字符串为回文字符串")
# else:
#     print("该字符串不是回文")

# a='asdf'
# print(a[1:-1])

# a=[x for x in range(10)]
# b=(x for x in range(10))
# print(a)
# for i in b:
#     print(i)
# print(1 and 2)
# print(1 or 2)
# print(0 or 1)
# class Parent(object):
#     x = 1
#
# class Child1(Parent):
#     pass
#
# class Child2(Parent):
#     pass
#
# print(Parent.x, Child1.x, Child2.x)
# Child1.x = 2
# print(Parent.x, Child1.x, Child2.x)
# Parent.x = 3
# print(Parent.x, Child1.x, Child2.x)
# A0 = dict(zip(('a','b','c','d','e'),(1,2,3,4,5)))
# A1 = range(10)
# A2 = [i for i in A1 if i in A0]
# A3 = [A0[s] for s in A0]
# A4 = [i for i in A1 if i in A3]
# A5 = {i:i*i for i in A1}
# A6 = [[i,i*i] for i in A1]
# # print(A0,
# #       A1,
# #       A2,A3,A4,A5,A6)
# print(A0)
# for s in A0:
#     print(s)
# import random
# a=random.random()
# a=random.uniform(1,100)
# print(a)

# print([[x for x in range(1,100)][i:i+3] for i in range(0,len(list_a),3)])
# print([[x for x in range(1,101)][i:i+3] for i in range(0,100,3)])
# def f():
#     a=range(6)
#     for i in a:
#         yield i
#     # print(a)
#     # pass
# aa=f()
# print(aa)
#
# for i in aa:
#     print(i)

# def f(aa,list=[]):
#     list.append(aa)
#     return list
# a1=f(10)
# a2=f(123,[])
# a3=f('a')
# print(a1)
# print(a2)
# print(a3)

# data1=dict.fromkeys(['lilei','peace'],[])
# print(data1)
# data2=data1.copy()
# data2['lilei'].append(666)
# print('data1=%s'%data1)
# print('data2=%s'%data2)
# data2['lilei']=777
# print('data1=%s'%data1)
# print('data2=%s'%data2)

# class a(object):
#     x=sum(range(0,5))
# class b(a):
#     pass
# class c(a):
#     pass
# print(a.x,b.x,c.x)
# # print(b.x)
# b.x=5.0//2.0
# print(a.x,b.x,c.x)
# a.x=5/2
# # print(b.x)
# print(a.x,b.x,c.x)

# import re
# data="oiudasmiasdiuthjdks79854.,;'346871325asd4f "
# result=re.search('asd',data)
# print(result.start())
# print(result.end())
# print(result.span())
# print(result.expand('result is \g<0>'))
